package com.gp.gback.system.common.page;

import com.gp.gback.system.common.annotation.APIField;
import com.gp.gback.system.common.annotation.APIValueObject;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

/**
 * Created by zhiyong.guo on 2017/8/16.
 */
@APIValueObject("分页结果")
public class PagingResultDTO<I> implements Serializable {
    private Integer maxPage = Integer.valueOf(0);
    @APIField("页码，从1开始")
    private Integer pageNum = Integer.valueOf(1);
    private static final Integer DEFAULT_PAGE_SIZE = Integer.valueOf(10);
    @APIField("每页显示多少记录")
    private Integer pageSize;
    @APIField("总记录数")
    private Integer total;
    @APIField("结果集")
    private List<I> items;

    public PagingResultDTO() {
        this.pageSize = DEFAULT_PAGE_SIZE;
        this.total = Integer.valueOf(0);
        this.items = Collections.emptyList();
    }

    public Integer getMaxPage() {
        return this.maxPage;
    }

    public void setMaxPage(Integer maxPage) {
        this.maxPage = maxPage;
    }

    public Integer getPageNum() {
        return this.pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return this.pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getTotal() {
        return this.total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public List<I> getItems() {
        return this.items;
    }

    public void setItems(List<I> items) {
        this.items = items;
    }
}
